﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace WindowsGame1
{
    static class Input
    {
        private static KeyboardState ks;
        private static KeyboardState old_ks;

        public static void Update()
        {
            old_ks = ks;
            ks = Keyboard.GetState();
        }

        public static bool GetKey(Keys k)
        {
            return ks.IsKeyDown(k);
        }

        public static bool GetKeyUp(Keys k)
        {
            if (!ks.IsKeyDown(k)) return true;
            return false;
        }

        public static bool GetKeyDown(Keys k)
        {
            if (ks != old_ks && ks.IsKeyDown(k)) return true;
            return false;
        }

        public static bool GetKeyReleased(Keys k)
        {
            return ks != old_ks && old_ks.IsKeyDown(k);
        }

    }
}
